home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
stazsoftware.com
/
www.stazsoftware.com.tar
/
www.stazsoftware.com
/
futurebasic
/
sample-code
/
helpProj.sit
/
Help Project Folder
/
Help
/
2 List Display
< prev
next >
Wrap
Text File
|
2005-04-15
|
5KB
|
87 lines
<HTML>
<HEAD>
<TITLE>2 Recent Changes</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<B><FONT COLOR="#0000ff"><IMG SRC="Images/Dabs%20logo.jpg" WIDTH="118"
HEIGHT="94" ALIGN="BOTTOM" BORDER="0"></FONT></B>
<P> </P>
<P><B><FONT COLOR="#0000ff">In earlier versions of FB and using
PG we had a very easy to use method of creating and viewing lists.
To date we don't have an OSX version of that set of commands so
I created this list manager for my own use. It has the ability
to display lists in any desired font, size and color and can also
display small graphics. It uses String Resources for the text
at this point but small modifications could use anything.</FONT></B></P>
<P>The first thing to do to create the list is review the record
we create for managing lists and list display. Here is the basics.</P>
<P>BEGIN Record ListRecord<BR>
DIM as int ncols 'number
of colums<BR>
dim as long numRecords 'number
of records filled in after first drawing<BR>
dim as int STResNo 'Using
a String Resource in this example<BR>
DIM as int LScrollBtn<BR>
DIM as LONG LScrlBtnMax<BR>
dim as rect ListRect 'The
overall rectangle for the list<BR>
DIM as rect selrect[20]<BR>
DIM as int colwd%[20] '20
columns each can have their own width<BR>
Dim as RGBCOLOR RGB[20] 'each
column can have a different color<BR>
DIM as INT txtalign[20] 'left
= 0, right = 1, center = 2<BR>
DIM as int oldselect 'the
list row previously selected<BR>
dim as int newselect 'the
new selection if there is one<BR>
dim as int WhichString 'which
string in the resouce selected<BR>
DIM as INT buttonsized<BR>
dim as int fnt 'the
font to use<BR>
dim as int sze 'the
size to use<BR>
dim as int styl 'the
style to use<BR>
DIM as str255 2 delim$ 'the
delimiting character for each row<BR>
DIM as str255 2 icon$ 'the
delim string noting what follows is an icon id and not a string<BR>
end record<BR>
</P>
<P>Using this record format we initialize the list using a local
function to set the above items or get them from a preference
and then set them</P>
<P>Two basic functions handle the list from here on.</P>
<P>1. DoListSelection$ Detects a mouse click on the list and returns
the text for that cell. It also detects if you moved the mouse
up or down in the list and above or below the list rectangle to
correctly redraw the list.</P>
<P>2. DrawList takes the responsibility for drawing the list.
Follow the code and you can see how we set colors for the text
and cells, draw the selected cell and draw an icon with the cell
if you have set the list up that way.</P>
<P><B><FONT COLOR="#ff0000">To add new topics you simply drop
them in the Help folder. Each time the help window is displayed
it rebuilds the list of topics from the contents of the Help folder.</FONT></B></P>
<P><B><FONT COLOR="#ff0000">Mostly these few help topics are just
for blah, blah to show the help system. More notes exist on the
code.</FONT></B>
</BODY>
</HTML>